﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;

namespace Diagram.DynamicDiagram
{
    public abstract class Data
    {
        #region Properties
        private String _name;
        private String _Chinese;
        private List<int> _defaultColumnPos;
        private double _min;
        private double _max;
        private List<double> _dataList;

        public List<double> DataList
        {
            get { return _dataList; }
            set { _dataList = value; }
        }

        public String Name
        {
            get { return _name; }
            set { _name = value; }
        }

        public String Chinese
        {
            get { return _Chinese; }
            set { _Chinese = value; }
        }

        public List<int> DefaultColumnPos
        {
            get { return _defaultColumnPos; }
            set { _defaultColumnPos = value; }
        }

        public double Min
        {
            get { return _min; }
            set { _min = value; }
        }

        public double Max
        {
            get { return _max; }
            set { _max = value; }
        }
        #endregion

        #region 构造函数
        public void initializeData(DataSet ds)
        {
            _defaultColumnPos = new List<int>();
            _dataList = new List<double>();
            for (int i = 0; i < ds.Tables[0].Rows.Count; ++i)
            {
                _dataList.Add(Convert.ToDouble(ds.Tables[0].Rows[i][_name]));
            }
            setSpan();
        }

        public virtual void setSpan()
        {
            _min = _dataList.Min() * 0.8;
            _max = _dataList.Max() * 1.2;
        }
        #endregion
    }

    #region ConcreteDataRegion
    public class DEPTMEAS : Data
    {
        public DEPTMEAS()
        {
            Name = "DEPTMEAS";
        }
        public override void setSpan()
        {
            Min = DataList.Min();
            Max = DataList.Max();
        }
    }

    public class TVOLACT : Data
    {
        public TVOLACT()
        {
            Name = "TVOLACT";
            Chinese = "总池体积(m3)";
        }
    }

    public class MFIA : Data
    {
        public MFIA()
        {
            Name = "MFIA";
            Chinese = "入口流量(L/s)";
        }
    }

    public class MFOA : Data
    {
        public MFOA()
        {
            Name = "MFOA";
            Chinese = "出口流量(L/s)";
        }
    }

    public class SPPA : Data
    {
        public SPPA()
        {
            Name = "SPPA";
            Chinese = "实测立压(MPa)";
        }
    }

    public class ROPA : Data
    {
        public ROPA()
        {
            Name = "ROPA";
            Chinese = "钻时(min/m)";
        }
    }
    public class MTOA : Data
    {
        public MTOA()
        {
            Name = "MTOA";
            Chinese = "温度(°C)";
        }
    }
    public class _SPPA : Data
    {
        public _SPPA()
        {
            Name = "_SPPA";
            Chinese = "计算立压(MPa)";
        }
    }
    public class BHPressure : Data
    {
        public BHPressure()
        {
            Name = "BHPressure";
            Chinese = "井底压力(g/cm3)";
        }
    }

    public class BurstPressure : Data
    {
        public BurstPressure()
        {
            Name = "BurstPressure";
            Chinese = "破裂压力(g/cm3)";
        }
    }

    public class HKLA : Data
    {
        public HKLA()
        {
            Name = "HKLA";
            Chinese = "实测悬重(KN)";
        }
    }

    public class TORQA : Data
    {
        public TORQA()
        {
            Name = "TORQA";
            Chinese = "实测扭矩(KN/m)";
        }
    }

    public class _TORQA : Data
    {
        public _TORQA()
        {
            Name = "_TORQA";
            Chinese = "计算扭矩(KN/m)";
        }
    }

    public class RPMA : Data
    {
        public RPMA()
        {
            Name = "RPMA";
            Chinese = "转盘转速(r/min)";
        }
    }

    public class _HKLA : Data
    {
        public _HKLA()
        {
            Name = "_HKLA";
            Chinese = "计算悬重(KN)";
        }
    }

    public class DSLF : Data
    {
        public DSLF()
        {
            Name = "DSLF";
            Chinese = "钻柱侧向力(KN)";
        }
    }

    #endregion
}
